using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Common.Enum;

namespace Converters
{
	public class VisibilityTubeTemperatureConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value != DependencyProperty.UnsetValue && value is ETemperatureControlMode && parameter != null)
			{
				ETemperatureControlMode eTemperatureControlMode = (ETemperatureControlMode)value;
				string text = parameter.ToString();
				if (text == "Module")
				{
					return (eTemperatureControlMode != 0 && eTemperatureControlMode != ETemperatureControlMode.Tube) ? Visibility.Collapsed : Visibility.Visible;
				}
				if (text == "Tube")
				{
					return (eTemperatureControlMode != ETemperatureControlMode.Tube && eTemperatureControlMode != ETemperatureControlMode.Fast) ? Visibility.Collapsed : Visibility.Visible;
				}
			}
			return Visibility.Collapsed;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return value;
		}
	}
}
